home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Periodicals / develop / develop 3 code / Surf's Up! / Interfaces / CIncludes / TMIntf.h < prev   
Encoding:
Text File  |  1989-11-17  |  6.5 KB  |  250 lines  |  [TEXT/MPS ]

  1. //
  2. //    TMIntf.h
  3. //    C Interface to the Terminal Manager
  4. //
  5. //    Copyright © Apple Computer, Inc. 1988, 1989
  6. //    All rights reserved.
  7. //
  8. //
  9.  
  10. #ifndef __TMINTF__
  11. #define __TMINTF__
  12.  
  13. #ifndef __DIALOGS__
  14. #include <Dialogs.h>
  15. #endif
  16.  
  17. #ifndef __CTBUTILS__
  18. #include <CTBUtils.h>
  19. #endif
  20.  
  21. #ifndef __CMINTF__
  22. #include <CMIntf.h>
  23. #endif
  24.  
  25. // current Terminal Manager version 
  26. #define        curTMVersion    1
  27.  
  28. // current Terminal Manager Environment Record version 
  29.  
  30. #define        curTermEnvRecVers    0
  31.  
  32. // error codes
  33. typedef    OSErr TMErr;
  34.  
  35. #define        tmGenericError    -1
  36. #define        tmNoErr            0
  37. #define        tmNotSupported    7
  38. #define        tmNoTools        8
  39.  
  40. // TMFlags 
  41. typedef long TMFlags;
  42.  
  43. enum {
  44.     tmInvisible         = 1 << 0,
  45.     tmSaveBeforeClear     = 1 << 1,
  46.     tmNoMenus             = 1 << 2,
  47.     tmAutoScroll         = 1 << 3
  48. };
  49.  
  50. // TMSelTypes & TMSearchTypes
  51. typedef short TMSelTypes;
  52. typedef short TMSearchTypes;
  53.  
  54. enum {
  55.     selTextNormal         = 1 << 0,
  56.     selTextBoxed         = 1 << 1,
  57.     selGraphicsMarquee     = 1 << 2,
  58.     selGraphicsLasso     = 1 << 3,
  59.     
  60.     tmSearchNoDiacrit     = 1 << 8,            //    These are only for TMSearchTypes
  61.     tmSearchNoCase         = 1 << 9
  62. };
  63.  
  64. //    TMCursorTypes 
  65. typedef short TMCursorTypes;
  66. enum {
  67.     cursorText = 1,
  68.     cursorGraphics = 2
  69. };
  70.  
  71. //    TMTermTypes 
  72. typedef short TMTermTypes;
  73. enum {
  74.     tmTextTerminal         = 1 << 0,
  75.     tmGraphicsTerminal     = 1 << 1
  76. };
  77.  
  78. struct    TermDataBlock {
  79.         TMTermTypes        flags;    
  80.         Handle            theData;
  81.         Handle            auxData;
  82.         long            reserved;
  83. };
  84.  
  85. #ifndef __cplusplus
  86. typedef struct TermDataBlock TermDataBlock;
  87. #endif
  88.  
  89. typedef TermDataBlock *TermDataBlockPtr, **TermDataBlockH;
  90.  
  91. struct TermEnvironRec {
  92.         short            version;
  93.         TMTermTypes        termType;
  94.         short            textRows;
  95.         short            textCols;
  96.         Point            cellSize;
  97.         Rect            graphicSize;
  98.         Point            slop;
  99.         Rect            auxSpace;
  100. };
  101.  
  102. #ifndef __cplusplus
  103. typedef struct TermEnvironRec TermEnvironRec;
  104. #endif
  105.  
  106. typedef TermEnvironRec *TermEnvironPtr;
  107.     
  108. union TMSelection {
  109.         Rect            selRect;
  110.         RgnHandle        selRgnHandle;
  111. };
  112.  
  113. #ifndef __cplusplus
  114. typedef union TMSelection TMSelection;
  115. #endif
  116.  
  117. struct TermRecord {
  118.         short            procID;
  119.         
  120.         TMFlags            flags;
  121.         TMErr            errCode;
  122.         
  123.         long            refCon;
  124.         long            userData;
  125.         
  126.         ProcPtr            defProc;
  127.         
  128.         Ptr                config;
  129.         Ptr                oldConfig;
  130.         
  131.         ProcPtr            environsProc;
  132.         long            reserved1;
  133.         long            reserved2;
  134.     
  135.         Ptr                tmPrivate;
  136.                         
  137.         ProcPtr            sendProc;
  138.         ProcPtr            breakProc;
  139.         ProcPtr            cacheProc;
  140.         ProcPtr            clikLoop;
  141.         
  142.         WindowPtr        owner;
  143.         Rect            termRect;
  144.         Rect            viewRect;
  145.         Rect            visRect;
  146.         
  147.         long            lastIdle;
  148.         
  149.         TMSelection        selection;
  150.         TMSelTypes        selType;
  151.         
  152.         long            mluField;
  153. };
  154.  
  155. #ifndef __cplusplus
  156. typedef struct TermRecord TermRecord;
  157. #endif
  158.  
  159. typedef TermRecord **TermHandle, *TermPointer;
  160.  
  161. #ifdef __safe_link
  162. extern "C" {
  163. #endif
  164. extern pascal TMErr     InitTM(void); 
  165. extern pascal Handle     TMGetVersion(TermHandle hTerm);
  166. extern pascal short     TMGetTMVersion(void);
  167.  
  168. extern pascal TermHandle TMNew(const Rect *termRect, const Rect *viewRect, TMFlags flags, 
  169.                             short procID, WindowPtr owner, ProcPtr sendProc, 
  170.                             ProcPtr cacheProc, ProcPtr breakProc, ProcPtr clikLoop, ProcPtr environsProc,
  171.                             long refCon, long userData);
  172.  
  173. extern pascal void         TMDispose(TermHandle hTerm);
  174.  
  175. extern pascal void         TMKey(TermHandle hTerm, const EventRecord *theEvent);
  176. extern pascal void         TMUpdate(TermHandle hTerm, RgnHandle visRgn);
  177. extern pascal void         TMPaint(TermHandle hTerm, const TermDataBlock *theTermData, const Rect *theRect);
  178. extern pascal void         TMActivate(TermHandle hTerm, Boolean activate);
  179. extern pascal void         TMResume(TermHandle hTerm, Boolean resume);
  180. extern pascal void         TMClick(TermHandle hTerm, const EventRecord *theEvent);
  181. extern pascal void         TMIdle(TermHandle hTerm);
  182.  
  183. extern pascal long         TMStream(TermHandle hTerm, Ptr theBuffer, long theLength, CMFlags flags);
  184. extern pascal Boolean     TMMenu(TermHandle hTerm, short menuID, short item);
  185.  
  186. extern pascal void         TMReset(TermHandle hTerm);
  187. extern pascal void         TMClear(TermHandle hTerm);
  188.  
  189. extern pascal void        TMResize(TermHandle hTerm, const Rect *newViewRect);
  190.  
  191. extern pascal long         TMGetSelect(TermHandle hTerm, Handle theData, ResType *theType);
  192. extern pascal void         TMGetLine(TermHandle hTerm, short lineNo, TermDataBlock *theTermData);
  193. extern pascal void         TMSetSelection(TermHandle hTerm, const TMSelection *theSelection, TMSelTypes selType);
  194.  
  195. extern pascal void         TMScroll(TermHandle hTerm, short dh, short dv);
  196.  
  197.  
  198. extern pascal Boolean     TMValidate(TermHandle hTerm);
  199. extern pascal void         TMDefault(Ptr *theConfig, short procID, Boolean allocate);
  200.  
  201. extern pascal Handle     TMSetupPreflight(short procID, long *magicCookie);
  202. extern pascal void         TMSetupSetup(short procID, Ptr theConfig, short count, 
  203.                             DialogPtr theDialog, long *magicCookie);
  204. extern pascal Boolean     TMSetupFilter(short procID, Ptr theConfig, short count, 
  205.                             DialogPtr theDialog, EventRecord *theEvent,
  206.                             short *theItem, long *magicCookie);
  207. extern pascal void         TMSetupItem(short procID, Ptr theConfig, short count, 
  208.                             DialogPtr theDialog, short *theItem, long *magicCookie);
  209. extern pascal void         TMSetupCleanup(short procID, Ptr theConfig, short count, 
  210.                             DialogPtr theDialog, long *magicCookie);
  211. extern pascal void         TMSetupPostflight(short procID);
  212.  
  213. extern pascal Ptr         TMGetConfig(TermHandle hTerm);
  214. extern pascal short     TMSetConfig(TermHandle hTerm, Ptr thePtr);
  215.  
  216. extern pascal OSErr     TMIntlToEnglish(TermHandle hTerm, Ptr inputPtr, 
  217.                             Ptr *outputPtr, short language);
  218. extern pascal OSErr     TMEnglishToIntl(TermHandle hTerm, Ptr inputPtr, 
  219.                             Ptr *outputPtr, short language);
  220.  
  221. extern pascal void         TMGetToolName(short id, Str255 name);
  222. extern pascal short     TMGetProcID(const Str255 name);
  223.  
  224. extern pascal void         TMSetRefCon(TermHandle hTerm, long refCon);
  225. extern pascal long         TMGetRefCon(TermHandle hTerm);
  226.  
  227. extern pascal void         TMSetUserData(TermHandle hTerm, long userData);
  228. extern pascal long         TMGetUserData(TermHandle hTerm);
  229.  
  230. extern pascal short     TMAddSearch(TermHandle hTerm, const Str255 theString, const Rect *where, 
  231.                             TMSearchTypes searchType, ProcPtr callBack);
  232. extern pascal void         TMRemoveSearch(TermHandle hTerm, short refnum);
  233. extern pascal void         TMClearSearch(TermHandle hTerm);
  234.  
  235. extern pascal Point     TMGetCursor(TermHandle hTerm, TMCursorTypes cursType);
  236.  
  237. extern pascal TMErr     TMGetTermEnvirons(TermHandle hTerm, TermEnvironRec *theEnvirons);
  238.  
  239. extern pascal short     TMChoose(TermHandle *hTerm, Point where, ProcPtr idleProc);
  240. extern pascal void         TMEvent(TermHandle hTerm, const EventRecord *theEvent);
  241.  
  242. extern pascal Boolean     TMDoTermKey(TermHandle hTerm, const Str255 theKey);
  243. extern pascal short     TMCountTermKeys(TermHandle hTerm);
  244. extern pascal void         TMGetIndTermKey(TermHandle hTerm, short id, Str255 theKey);
  245. #ifdef __safe_link
  246. }
  247. #endif
  248.  
  249. #endif __TMINTF__
  250.